/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package models;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 *
 * @author Yaroslav
 */
@Entity
@Table(name="tables", catalog="", schema="")
@NamedQueries({
    @NamedQuery(name="tables.getFreeTables", query = "SELECT t FROM tables t WHERE t.id = :id_table" )
})
public class Tables extends  BaseEntity  implements Serializable {
    private static final long serialVersionUID = 1L;
    
    @OneToMany(mappedBy="id_table")
    private List<Orders> listOrder;
    
    @Column(name="count")
    private int countSeats;

    
    
    
    public Tables() {
    }
    
    public Tables(Long id) {
        this.id = id;
    } 
    
    
    public Tables(int countSeats) {
        this.countSeats = countSeats;
    }
    
    
    public int  getCountSeats() {
        return countSeats;
           }
           
           
    public void setCountSeats(int countSeats) {
        this.countSeats = countSeats;
    }
    
    public List<Orders> getListOrder() {
        return listOrder;
    }

    public void setListOrder(List<Orders> ListOrder) {
        this.listOrder = ListOrder;
    }
    
    

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tables)) {
            return false;
        }
        Tables other = (Tables) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "models.Tables[ id=" + id + " ]";
    }
    
}
